package com.add;

import java.sql.Connection;

import java.sql.PreparedStatement;
import java.sql.ResultSet;

import com.jdbcUtil.JDBCUtil;

public class Job2ImplAdd{

public boolean add(int id, Job2 job) {
		
		Connection conn=null;
		PreparedStatement ps=null;
		ResultSet rs=null;
		String sql="insert into jobtype2 (postid, jobtype, jobname,paytype, date,time1,time2,time3,salary, place, notice,jobstate) values (?,?, ?,?,?,?,?,?,?,?,?,?);";
		try{
			conn=JDBCUtil.getConnection();
			ps=JDBCUtil.getStatement(conn, sql);
			ps.setInt(1, id);
			ps.setString(2, job.getJobType());
			ps.setString(3, job.getJobName());
			ps.setString(4, job.getPayType());
			ps.setString(5, job.getDate());
			ps.setString(6, job.getTime1());
			ps.setString(7, job.getTime2());
			ps.setString(8, job.getTime3());
			ps.setInt(9, job.getSalary());
			ps.setString(10, job.getPlace());
			ps.setString(11, job.getNotice());
			ps.setInt(12, job.getState());
			int result=ps.executeUpdate();
			if(result<0){
				return false;
			}
			
		}catch(Exception e){
			System.out.println(e);
		}
		finally{
			JDBCUtil.free(conn, ps, rs);
		}
		return true;
	}

}
